/**
 * 我的订单
 * @author Qasim <15750783791@163.com>
 * @version 2016/10/31
 */
var self = memberInfo = ''
document.addEventListener('plusready' , ready ,  false);

function ready(){
	self = plus.webview.currentWebview(); 
	memberInfo = plus.storage.getItem('memberInfo');
	memberInfo = $.parseJSON(memberInfo);
	//我的订单
	$.ajax({
		type:"post",  
		url:apiRoot + "/Home/Order/myOrder/", 
		data:{
			uid :  memberInfo.aid 
		},
		beforeSend:function(){
			plus.nativeUI.showWaiting('加载中...');
		},
		complete:function(){
			plus.nativeUI.closeWaiting();
		},
		dataType:'json',
 		success : function(data){
 			if(data){
 				$.each(data , function(k ,v){
 					var html = '<div class="list-p"><ul class="mui-table-view"><li class="mui-table-view-cell mui-media">';
 						html += '<a href="javascript:;" class="details" data-id="'+v.id+'" data-price="'+v.price+'"><img class="mui-media-object mui-pull-left" src="'+getImgUrl(v.litpic , "../public/img/book.jpg")+'">';
   						html += '<div class="mui-media-body"><span class="mui-h5 back">'+v.book_name+'</span>';
   						html += '<p class="mui-h6 detail">'+v.description+'</p>';
						html += '<p class="autor"><span class="mui-h6 back">'+v.author+'</span></p></div></a>';
						html += '<span><button type="button" class="mui-btn"> 阅 读 </button></span></li></ul></div>';
						$('.lists').append(html)
 				})
				$('.details').unbind();
			    $('.details').on('click' , function(){ 
			    	bookDetails($(this).attr('data-id') , $(this).attr('data-price'),self.id)
			    });
				      
			    $('.list-p button').unbind();
			    $('.list-p button').on('click' , function(){
			    	
			    });
 				
 				
 			}else{
 				toast('暂无记录');
 			}
 		},
 		error :function(e){
 			errorPrompt(e);	
 		}
 	})
	
	
}